这里是Go语言使用Redis实现的代码:
go
package main

import (
    "fmt"
    "github.com/go-redis/redis"
)

func main() {
    // 连接redis
    client := redis.NewClient(&redis.Options{
        Addr:     "localhost:6379",
        Password: "",
    })

    // 用户id
    uid := "user1"

    // 浏览商品
    goods := []string{"apple", "orange", "banana", "grape", "strawberry"}
    for _, v := range goods {
        client.LPush(uid, v)  // 将商品名加入列表左侧
    }

    // 取出用户最近浏览的10个商品名
    recentGoods := client.LRange(uid, 0, 9).Val() 

    // 打印商品名
    fmt.Println(recentGoods) 
}